<!DOCTYPE html>
<html lang="zh-CN">

<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <meta name="description" content="济南本地同城信息平台，提供招聘求职、房屋租售、二手交易、寻人寻物、吃喝玩乐等生活服务信息，快速发布和查找您需要的本地信息">
  <meta name="keywords" content="济南便民同城">
  <meta name="robots" content="index, follow">
  <meta name="author" content="济南便民港">
  <link rel="canonical" href="https://pc.jngkxx.top">

  <!-- 社交媒体Meta标签 -->
  <meta property="og:title" content="济南便民港 - 本地生活服务平台">
  <meta property="og:description" content="提供全面的本地生活服务信息，包括招聘、租房、二手交易等">
  <meta property="og:type" content="website">
  <meta property="og:url" content="https://pc.jngkxx.top">
  <meta property="og:image"
    content="https://file.jngkxx.top/%E6%B3%89%E5%9F%8E%E7%94%9F%E6%B4%BB%E6%B4%BE%EF%BC%88%E6%96%B0%EF%BC%89/%E7%B3%BB%E7%BB%9F%E6%96%87%E4%BB%B6/logo/logo.png">

  <!-- Twitter卡片 -->
  <meta name="twitter:card" content="summary_large_image">
  <meta name="twitter:title" content="济南便民港 - 本地生活服务平台">
  <meta name="twitter:description" content="提供全面的本地生活服务信息，包括招聘、租房、二手交易等">
  <meta name="twitter:image"
    content="https://file.jngkxx.top/%E6%B3%89%E5%9F%8E%E7%94%9F%E6%B4%BB%E6%B4%BE%EF%BC%88%E6%96%B0%EF%BC%89/%E7%B3%BB%E7%BB%9F%E6%96%87%E4%BB%B6/logo/logo.png">

  <link href="css/style.css" rel="stylesheet" type="text/css" media="all" />
  <!-- 网站图标 -->
  <link rel="icon" href="/favicon.ico" type="image/x-icon">
  <link rel="apple-touch-icon" href="/apple-touch-icon.png">

  <script src="js/jquery-1.11.0.min.js"></script>
  <!-- 引入 Simple Paging Plugin -->
  <script src="js/jquery.simplePagination.js"></script>


  <script>
    var _hmt = _hmt || [];
    (function () {
      var hm = document.createElement("script");
      hm.src = "https://hm.baidu.com/hm.js?3870faa0024f9253fdce6fd555ff25d7";
      var s = document.getElementsByTagName("script")[0];
      s.parentNode.insertBefore(hm, s);
    })();
  </script>

  <!-- 结构化数据 -->
  <script type="application/ld+json">
    {
      "@context": "https://schema.org",
      "@type": "WebSite",
      "name": "济南便民港",
      "url": "https://pc.jngkxx.top",
      "potentialAction": {
        "@type": "SearchAction",
        "target": "https://pc.jngkxx.top/search?q={济南便民港}",
        "query-input": "required name=济南便民港"
      }
    }
    </script>

  <title>济南便民港</title>
</head>

<body>
  <!-- 头部区域 -->
  <header>
    <div class="container">
      <div class="header-top">
        <H2 class="logo">济南便民港</H2>
        <div class="search-box">
          <input id="searchInput" type="text" placeholder="搜索您需要的信息...">
          <button id="search">搜索</button>
        </div>
        <div class="user-actions">
          <a href="#" class="myBtn">登录</a>
          <a href="#" class="myBtn">注册</a>
          <a href="#" class="myBtn">发布信息</a>
        </div>
      </div>
    </div>
    <nav>
      <div class="container">
        <ul class="nav-menu" id="nav-menu">
          <li><a href="#" data-id="">全部</a></li>
          <li><a href="#" data-id="1">招聘求职</a></li>
          <li><a href="#" data-id="3">车人互找</a></li>
          <li><a href="#" data-id="2">房屋租售</a></li>
          <li><a href="#" data-id="4">寻人寻物</a></li>
          <li><a href="#" data-id="5">吃喝玩乐</a></li>
          <li><a href="#" data-id="6">济南打听</a></li>
          <li><a href="#" data-id="7">商品促销</a></li>
          <li><a href="#" data-id="8">二手物品</a></li>
          <li><a href="#" data-id="9">宠物信息</a></li>
        </ul>
      </div>
    </nav>
  </header>

  <!-- 主要内容区域 -->
  <main class="container">
    <!-- 统计信息 -->
    <div class="stats" id="stats">
      <!-- <div class="stat-item">
                    <div class="stat-number">12,568</div>
                    <div class="stat-label">今日浏览量</div>
                </div>
                <div class="stat-item">
                    <div class="stat-number">328</div>
                    <div class="stat-label">今日发布量</div>
                </div>
                <div class="stat-item">
                    <div class="stat-number">45,792</div>
                    <div class="stat-label">总用户量</div>
                </div>
                <div class="stat-item">
                    <div class="stat-number">1,256</div>
                    <div class="stat-label">在线用户</div>
                </div> -->
    </div>

    <!-- 帖子列表 -->
    <div class="post-list">
      <div class="post-header">
        <h2 class="post-title">最新信息</h2>
        <!-- <div class="post-filter">
                        <a href="#" class="active">全部</a>
                        <a href="#">招聘</a>
                        <a href="#">二手</a>
                        <a href="#">服务</a>
                    </div> -->
      </div>

      <div id="posting">
        <!-- 置顶帖子 -->
        <!-- <div class="post-item sticky">
                      <div class="post-image">
                          <img src="https://via.placeholder.com/120x90" alt="置顶帖子图片">
                      </div>
                      <div class="post-content">
                          <h3><a href="#">【置顶】平台使用规则及注意事项</a></h3>
                          <div class="post-meta">
                              <span>发布者：管理员</span>
                              <span>发布时间：2023-06-15</span>
                              <span>浏览：2568</span>
                          </div>
                          <p class="post-excerpt">请各位用户遵守平台规则，文明发帖，禁止发布违法信息...</p>
                          <div class="post-tags">
                              <span class="post-tag">公告</span>
                              <span class="post-tag">规则</span>
                          </div>
                      </div>
                  </div> -->
      </div>

      <!-- 分页 -->
      <div id="paging-container">
        <!-- 分页内容将在这里显示 -->
      </div>
    </div>
  </main>

  <!-- 页脚区域 -->
  <footer>
    <div class="container">
      <div class="footer-content">
        <div class="footer-column ">
          <h3>服务项目</h3>
          <ul>
            <li><a href="#">招聘求职</a></li>
            <li><a href="#">房屋租售</a></li>
            <li><a href="#">二手交易</a></li>
            <li><a href="#">生活服务</a></li>
          </ul>
        </div>

        <div class="footer-column">
          <h3>联系我们</h3>
          <ul>
            <li>微信：jn_qcshp</li>
            <li>邮箱：jn_geke@163.com</li>
            <li>工作时间：9:00-18:00</li>
          </ul>
        </div>

        <div class="footer-column ">

          <h3>关于我们</h3>
          <ul>
            <img style="width: 100px;height: 100px;" src="images/code.jpg" alt="">
          </ul>
          </ul>
        </div>
      </div>

      <div class="copyright">
        &copy; 济南格柯信息科技有限责任公司 版权所有 | <a style="color: #bdc3c7;" href="https://beian.miit.gov.cn/"
          target="_blank">备案号：鲁ICP备2023007431号-1</a>
      </div>
    </div>
  </footer>
  <div id="myModal" class="modal">
    <div class="modal-content">
      <span class="close">&times;</span>

      <h2 class="modal-title">济南便民港</h2>

      <div class="qr-container">
        <img class="qr-code" src="images/code.jpg" alt="">
      </div>

      <div class="modal-text">请使用手机扫描二维码进行登录和发布信息，安全便捷，无需输入密码</div>
    </div>
  </div>
</body>
<script>
  let listData = {
    searchValue: '',
    pageSize: 10,
    pageNum: 1,
    code: '',
    genreId: '',
    type: 0,
    province: '',
    city: '',
    district: '',
    status: 3,
  }
  list()
  getFirstPageInfo()

  // 获取帖子列表
  function list() {
    $.ajax({
      url: "https://qcsh.jngkxx.top/wx/news/pageNewsList",
      dataType: "json",
      type: "get",
      async: "true/false",
      data: listData,
      success: function (res) {
        const { data } = res
        let list = data.list
        setDomList(list)
        setPage(data)
      },
      error: function (err) {
        console.log('--------', err)
      }
    });
  }

  // 获取统计数据
  function getFirstPageInfo() {
    $.ajax({
      url: "https://qcsh.jngkxx.top/wx/news/getFirstPageInfo",
      dataType: "json",
      type: "get",
      async: "true/false",
      data: {},
      success: function (res) {
        const { data } = res
        console.log('--------', data)
        setSTatDomList(data)
      },
      error: function (err) {
        console.log('--------', err)
      }
    });
  }

  // 设置分页
  function setPage(data) {
    console.log('container', data)
    // 使用 Simple Paging Plugin 进行分页
    $('#paging-container').pagination({
      items: data.total / 10,
      itemsOnPage: 10,
      cssStyle: 'post-pagination',
      currentPage: data.pageNum,
      firstText: '首页', // 第一页的文字
      lastText: '末页', // 最后一页的文字
      prevText: '上一页', // 上一页的文字
      nextText: '下一页', // 下一页的文字
      onPageClick: function (pageNumber, event) {
        console.log('pageNumber, event', pageNumber, event)
        listData.pageNum = pageNumber
        list()
      }
    });

  }
  // 定义一个函数来生成HTML字符串
  function createItemHTML(item) {
    return `<div class="post-item  ${item.isTop == 1 ? 'sticky' : ''}" onclick="location.href = '/detail.html?id=${item.id}'">
                      <div class="post-image">
                          <img src="${item.fileList.length > 0 ? item.fileList[0].fileUrl : ''}" alt="${item.genreColumnName || item.genreName}">
                      </div>
                      <div class="post-content">
                          <h3><a href="#"> ${item.isTop == 1 ? '【置顶】' : ''} ${item.genreColumnName}- ${item.content.slice(0, 20)}</a></h3>
                          <div class="post-meta">
                              <span>发布者：${item.releaseUserName}</span>
                              <span>发布时间：${item.refreshTimeDesc}</span>
                              <span>浏览：${item.browseCount}</span>
                          </div>
                          <div class="post-excerpt">${item.content}</div>
                      </div>
                  </div>`;
  }
  function setDomList(data) {
    // 使用map()方法生成HTML字符串数组，然后使用$.parseHTML()将它们转换为jQuery对象，最后添加到容器中
    var htmlStrings = data.map(createItemHTML);
    var $items = $.parseHTML(htmlStrings.join('')); // 将所有字符串合并成一个并转换为jQuery对象
    $("#posting").html('')
    $("#posting").append($items); // 添加到容器中
  }
  function creatSTatTHTML(data) {
    return `<div class="stat-item">
                    <div class="stat-number">${data.browseNum}</div>
                    <div class="stat-label">浏览量</div>
                </div>
                <div class="stat-item">
                    <div class="stat-number">${data.releaseNewsNum}</div>
                    <div class="stat-label">发布量</div>
                </div>
                <div class="stat-item">
                    <div class="stat-number">${data.userCount}</div>
                    <div class="stat-label">总用户量</div>
                </div>`
  }
  function setSTatDomList(data) {
    // 使用$.parseHTML()将它们转换为jQuery对象，最后添加到容器中
    var htmlStrings = creatSTatTHTML(data);
    var $items = $.parseHTML(htmlStrings); // 将所有字符串合并成一个并转换为jQuery对象
    $("#stats").append($items); // 添加到容器中
  }
  // 搜索
  $('#search').click((val) => {
    listData.pageNum = 1
    listData.searchValue = $('#searchInput').val()
    list()
  })
  // 导航栏点击
  $('#nav-menu a').click(function (event) {
    event.preventDefault(); // 阻止链接默认行为
    console.log('链接被点击: ', $(this).data('id')); // 输出被点击的链接文本
    listData.pageNum = 1
    listData.genreId = $(this).data('id')
    $('#nav-menu a').removeClass('nav-active')
    $(this).addClass('nav-active')
    list()
  });

  $(document).ready(function () {
    var modal = $('#myModal');
    var span = $('.close');

    $('.myBtn').click(function () {
      modal.css('display', 'block');
    });

    span.click(function () {
      modal.css('display', 'none');
    });

    $(window).click(function (event) {
      if (event.target == modal[0]) {
        modal.css('display', 'none');
      }
    });
  });
</script>

</html>